# This shell function divide a large reads file, $1, *.csfasta or *.fasta into two millions lines per file
# (about one million reads). A list of split files $.txt will be generated. 
# Note if the reads has odd comman line, this may cause missing read tag
readsSetFile=$(basename $1)
baseName=$(basename $readsSetFile ".csfasta")
baseName=$(basename $baseName ".fasta")
extName=$(echo $readsSetFile | sed "s/$baseName//g")
split -l 2000000 $1 $baseName"_" 
splitFiles=$(ls $baseName"_"[a-z]*)
for splitFile in $splitFiles;
do mv ./$splitFile $splitFile$extName; done
listFile=$baseName".txt"
ls $baseName"_"[a-z]*$extName > $listFile
